import Mock from 'mockjs'
import setupMock, { successResponseWrap } from '@/libs/setup-mock'

setupMock({
    setup() {
        // 获取图片分类列表
        Mock.mock(new RegExp('api/app/img/category/list'), 'post', () => {
            return {
                "Code": 0,
                "Data": [
                    {
                        "Id": "cg5amnkvpifo2vfto1eg",
                        "CreatedAt": null,
                        "UpdatedAt": null,
                        "Version": "",
                        "Name": "分类1",
                        "Weight": 0,
                        "Type": 0,
                        "IsHot": 0,
                        "Status": 0,
                        "ParentId": "",
                        "ImgCount": 46
                    },
                    {
                        "Id": "c7qft5cvpifo91f61ob0",
                        "CreatedAt": null,
                        "UpdatedAt": null,
                        "Version": "",
                        "Name": "分类2",
                        "Weight": 0,
                        "Type": 0,
                        "IsHot": 0,
                        "Status": 0,
                        "ParentId": "",
                        "ImgCount": 0
                    }
                ],
                "Message": "获取成功！",
                "Status": 1
            }
        })

        // 获取图片列表
        Mock.mock(new RegExp('api/app/img/list'), 'get', () => {
            return {
                "Code": 0,
                "Data": {
                    "total_record": 474,
                    "total_page": 10,
                    "offset": 0,
                    "limit": 50,
                    "page": 1,
                    "prev_page": 1,
                    "next_page": 2,
                    "records": [
                        {
                            "Id": "ch5o00pj34qcomlpnofg",
                            "CreatedAt": null,
                            "UpdatedAt": null,
                            "Version": "",
                            "CategoryId": "",
                            "Title": "ch5o00pj34qcomlpnof0.png",
                            "OrignalTitle": "图像 8.png",
                            "URL": "https://res.waliapp.cn/apps/binfbsc6no9k7p6m6ac0/bq2jof278lvdaisp29bg/res/images/2023/04/ch5o00pj34qcomlpnoe0.png",
                            "Width": 0,
                            "Height": 0,
                            "Mime": "",
                            "MemberId": ""
                        },
                        {
                            "Id": "cgbqflcvpifso0r1rcg0",
                            "CreatedAt": null,
                            "UpdatedAt": null,
                            "Version": "",
                            "CategoryId": "",
                            "Title": "cgbqflcvpifso0r1rcfg.png",
                            "OrignalTitle": "652b38df351bc403a48f35407e192913.png",
                            "URL": "https://res.waliapp.cn/apps/binfbsc6no9k7p6m6ac0/res/images/cgbqflcvpifso0r1rcf0.png",
                            "Width": 0,
                            "Height": 0,
                            "Mime": "",
                            "MemberId": ""
                        },
                        {
                            "Id": "cg7d3nsvpifq2hcv6dag",
                            "CreatedAt": null,
                            "UpdatedAt": null,
                            "Version": "",
                            "CategoryId": "cg5amnkvpifo2vfto1eg",
                            "Title": "cg7d3nsvpifq2hcv6da0.png",
                            "OrignalTitle": "top.451d650ecd.png",
                            "URL": "https://res.waliapp.cn/apps/binfbsc6no9k7p6m6ac0/res/images/cg7d3nsvpifq2hcv6d9g.png",
                            "Width": 0,
                            "Height": 0,
                            "Mime": "",
                            "MemberId": ""
                        }
                    ]
                },
                "Message": "获取成功！",
                "Status": 1
            }
        })

        // 删除图片分类
        Mock.mock(new RegExp('api/app/img/category/*'), 'delete', () => {
            return {
                "Code": 0,
                "Data": "",
                "Message": "删除分类成功",
                "Status": 1
            }
        })

        // 修改图片分类名称
        Mock.mock(new RegExp('api/app/img/category/*/*'), 'put', () => {
            return {
                "Code": 0,
                "Data": null,
                "Message": "修改分组名成功！",
                "Status": 1
            }
        })

        // 上传图片
        Mock.mock(new RegExp('api/app/img/upload'), 'post', () => {
            return {
                "Code": 0,
                "Data": {
                    "id": "ci57nikvpifovok3l170",
                    "imgPath": "https://res.waliapp.cn/apps/binfbsc6no9k7p6m6ac0/res/images/ci57nikvpifovok3l160.png",
                    "original": "guanjun.png",
                    "title": "ci57nikvpifovok3l16g.png",
                    "type": "image/png",
                    "url": "https://res.waliapp.cn/apps/binfbsc6no9k7p6m6ac0/res/images/ci57nikvpifovok3l160.png"
                },
                "Message": "保存图片成功！",
                "Status": 1
            }
        })

        // 保存/新建图片分类
        Mock.mock(new RegExp('api/app/img/category/save'), 'post', () => {
            return {
                "Code": 0,
                "Data": "ci57o0kvpifovok3l17g",
                "Message": "保存成功",
                "Status": 1
            }
        })

        // 删除图片
        Mock.mock(new RegExp('api/app/img/*'), 'delete', () => {
            return {
                "Code": 0,
                "Data": "",
                "Message": "删除图片成功",
                "Status": 1
            }
        })
    }
})
